package edu.hawaii.myisern.action;

import java.util.Iterator;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;
import edu.hawaii.myisern.collaborations.jaxb.Collaboration;
import edu.hawaii.myisern.model.MyIsernModel;
import edu.hawaii.myisern.organizations.jaxb.Organization;
import edu.hawaii.myisern.researchers.jaxb.Researcher;

/**
 * Handles the Printing of the Researcher, Organization
 * and Collaboration objects.
 * 
 * @author Sonwright M. Gomez
 *
 */
public class DisplayActionBean extends MyIsernActionBean {
  
  /** The singleton MyIsernModel. */
  private MyIsernModel myIsern = MyIsernModel.getInstance();
  
  /**
   * Provides an iterator over the Collaboration list to the page. 
   * @return The Collaboration iterator.
   */
  public Iterator<Collaboration> getCollaborationIterator() {
    return myIsern.cIterator();
  }
  
  /**
   * Provides an iterator over the Researcher list to the page. 
   * @return The Researcher iterator.
   */
  public Iterator<Researcher> getResearcherIterator() {
    return myIsern.rIterator();
  }
  
  /**
   * Provides an iterator over the Researcher list to the page. 
   * @return The Researcher iterator.
   */
  public Iterator<Organization> getOrganizationIterator() {
    return myIsern.oIterator();
  }
    
  /**
   * Prints Researchers
   * @return ForwardResolution to redisplay the display.jsp page
   */
  public Resolution printResearchers() {
    return new ForwardResolution("/displayResearchers.jsp");
  }
  
  /**
   * Prints Organizations
   * @return ForwardResolution to redisplay the display.jsp page
   */
  public Resolution printOrganizations () {
    return new ForwardResolution("/displayOrganizations.jsp");
  }
  
  /**
   * Prints Collaborations
   * @return ForwardResolution to redisplay the display.jsp page
   */
  public Resolution printCollaborations () {
    return new ForwardResolution("/displayCollaborations.jsp");
  }
}
